package stateDiagram.figures;

import static org.jhotdraw.draw.AttributeKeys.TEXT;

import org.jhotdraw.draw.TextFigure;

import stateDiagram.EntityObjects.TransitionEntity;

public class TransitionEventTextFigure extends TextFigure{
	private TransitionEntity owner;
	public TransitionEventTextFigure(String text, TransitionEntity entity){
		super(text);
		owner = entity;
	}
	
	public void setText(String newText) {
        String previousContents = getText();
        willChange();
        if(previousContents != null && !previousContents.equals(newText)){
        	newText = newText.trim();
        	owner.setName(newText);
        }
        super.setText(newText);
        changed();
    }

}
